import { createApp } from 'vue'
import { createHead } from '@vueuse/head'
import App from './App.vue'
import router from './router'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

console.log('=== 应用启动调试 ===')
console.log('当前环境:', import.meta.env.MODE)
console.log('路由配置:', router.getRoutes())
console.log('=====================')

// 创建应用实例
const app = createApp(App)

const head = createHead();
app.use(head);

// 注册 Element Plus 图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 使用路由
app.use(router)

// 使用Element Plus
app.use(ElementPlus)

// 挂载到 #app 元素
app.mount('#app')

// 启动后调试
setTimeout(() => {
  console.log('=== 应用启动完成 ===')
  console.log('当前路径:', router.currentRoute.value.path)
  console.log('====================')
}, 1000)
